#ifndef _sbrush_spectral_model_h_
#define _sbrush_spectral_model_h_

#include "sms.h"
#include "sbrush_sms.h"
#include "dag.h"

#include <vector>
#include <memory>
#include <iostream>

namespace sbrush {

	class SmsCorruptFile : public SmsError {
	public:
		SmsCorruptFile();
		virtual ~SmsCorruptFile() throw();
	};
	
	/* TODO: will have to extend this class to be able to create spectral
	 * models on our own */
	class SpectralModel : public Sms {
		SpectralModel();
	public:
		SpectralModel& operator=(const SpectralModel& rhs);
		SpectralModel(const SpectralModel& copy);
		static std::auto_ptr<SpectralModel> read(const char* filename);
		static std::auto_ptr<SpectralModel> inflate(std::istream& binaryStream);
	
		virtual ~SpectralModel() throw();
		const SMS_Header* header() const;
		size_t getNumFrames() const;
		const SMS_Data& getFrame(size_t idx) const;
	
		bool write(const char* filename);
		void serialize(std::ostream& binaryStream) const;
	private:
		void clear();
		SMS_Header* m_Header;
		std::vector<SMS_Data*> m_Frames;
	};	
}


#endif